{% extends "management/base.html" %}
{% load staticfiles %}
{% block title %}注册{% endblock %}

{% block content %}

    <div class="container">
        <div class="row">
            <div class="col-md-6 col-md-offset-3 col-sm-10 col-sm-offset-1">
                {% if state == 'success' %}
                    <div class="well">
                        <h2 class="text-success text-center">注册成功！</h2>
                    </div>
                {% elif state == 'repeat_error' %}
                    <div class="well">
                        <h2 class="text-warning text-center">密码重复错误</h2>
                    </div>
                {% elif state == 'empty' %}
                    <div class="well">
                        <h2 class="text-warning text-center">密码不能为空</h2>
                    </div>
                {% elif state == 'user_exist' %}
                    <div class="well">
                        <h2 class="text-danger text-center">用户已经存在</h2>
                    </div>
                {% endif %}
                <form method="POST" role="form" class="form-horizontal">
                    {% csrf_token %}
                    <h1 class="form-signin-heading text-center">请注册</h1>

                    <div class="form-group">
                        <label for="id_user_name" class="col-md-3 control-label">用户名：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" id="id_user_name" required name="username"
                                   autofocus>
                            <span class="help-block">用于登陆，可以包括大小写字母和下划线。</span>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_name" class="col-md-3 control-label">昵称：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" required name="nickname" id="id_name">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_passwd" class="col-md-3 control-label">密码：</label>
                        <div class="col-md-9">
                            <input type="password" class="form-control" required name="password" id="id_passwd">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_repasswd" class="col-md-3 control-label">重复密码：</label>
                        <div class="col-md-9">
                            <input type="password" class="form-control" required name="repeat_password"
                                   id="id_repasswd">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="id_email" class="col-md-3 control-label">电子邮件：</label>
                        <div class="col-md-9">
                            <input type="email" class="form-control" required name="email" id="id_email">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-4 col-md-offset-4">
                            <button class="btn btn btn-primary btn-block" type="submit" id="id_submit">注册</button>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>

{% endblock %}